<?php

namespace App\Lib;

class LLRequest {

    /**
     * 从 UA 解析出[软件版本 | APP系统名 | 手机型号 | 渠道商ID]
     * @return array
     */
    public static function parse_app_ua() {
        $originalUA = [];

        $userAgent = $_SERVER['HTTP_H5_USER_AGENT'] ?? $_SERVER['HTTP_USER_AGENT'] ?? '';
        if (!empty($userAgent)) {
            $originalUA = explode(';', $userAgent);
        }

        return [
            'app' => $originalUA[0] ?? 'yyaudio',
            'version_no' => $originalUA[1] ?? '',
            'os_name' => $originalUA[2] ?? '',
            'device' => $originalUA[4] ?? '',
            'channel_id' => $originalUA[5] ?? '',
            'guid' => $originalUA[6] ?? ''
        ];
    }
}